<?php $userTypes = array("1" => $this->translate->_("Pet Owner"), "2" => $this->translate->_("Service Provider")); ?>
<div id="right">
	<div class="rightbox">
		<div class="context"><div class="in"><a href="javascript:void(0);" id="context_menu" class="icon_link the_down"><span></span></a></div></div>
		<div>
			<div class="left"><img src="/images/new/large/members.png" alt="<?php echo $this->title; ?>" /></div>
			<ul class="title-menu">
				<li><h3 class="ellipsis"><?php echo $this->title; ?></h3></li>
				<li>
					<?php
						echo $this->partial("accounts/search.phtml", array(
							"request" => $this->request,
							"translate" => $this->translate,
							"countries" => $this->countries,
							"genders" => $this->genders,
							"types" => $this->types,
							"action" => $this->url(array('controller'=>'accounts'), 'default', true).'/index'
						));
					?>
				</li>
			</ul>
		</div>
		<div class="clear tenpx"></div>
		<?php if(!$this->search || $this->filtered): ?>
			<?php foreach($this->filters as $key => $filter):
				$name = $key;
				if($name == 'other') $name = $this->translate->_('Other');
				if($name == 'all') $name = $this->translate->_('Select All');
			?>
				<?php if($filter): ?>
					<?php echo "<a class='". ($this->request->getParam('filter') == strtolower($key) ? "m_f_selected" : "m_f_active") ."' href='{$this->url(array('filter' => strtolower($key)))}'>{$name}</a>"; ?>
				<?php else: ?>
					<?php echo "<a class='m_f_inactive' href='#'>{$name}</a>"; ?>
				<?php endif; ?>
			<?php endforeach; ?>
			<div class="clear"><br /></div>
		<?php endif; ?>
		<?php if(isset($this->paginator) && count($this->paginator) > 0): ?>
			<?php if(!$this->search): ?>
				<?php if($this->filtered): ?>
					<h1><?php echo $this->filtered; ?></h1>
				<?php else: ?>
					<h1><?php echo $this->translate->_("Do you know these members already?"); ?></h1>
				<?php endif; ?>
				<br />
			<?php endif; ?>
			<div class="left">
				<input onclick="Petolio.go('<?php echo $this->url(array('list' => $this->list == 'grid' ? 1 : 0)); ?>');" type="button" value="<?php echo $this->list == 'grid' ? $this->translate->_("Switch to List >") : $this->translate->_("Switch to Grid >"); ?>" id="submit" name="prev" style="margin: 0px;">
				<div class="clear"></div>
			</div>
			<div class="clear tenpx"></div>
			<?php if($this->search || $this->filtered) echo $this->paginationControl($this->paginator, 'Elastic', 'pagination-controls.phtml', array('pos' => 'top')); ?>
			<?php include $this->list == 'grid' ? "grid-index.phtml" : "list-index.phtml"; ?>
			<?php if($this->search || $this->filtered) echo $this->paginationControl($this->paginator, 'Elastic', 'pagination-controls.phtml', array('pos' => 'bot')); ?>
			<div class="left">
				<input onclick="Petolio.go('<?php echo $this->url(array('list' => $this->list == 'grid' ? 1 : 0)); ?>');" type="button" value="<?php echo $this->list == 'grid' ? $this->translate->_("Switch to List >") : $this->translate->_("Switch to Grid >"); ?>" id="submit" name="prev" style="margin: 10px 0px 0px 0px;" />
			</div>
			<div class="clear"></div>
		<?php else: ?>
			<b class="red bigger"><?php echo $this->translate->_("No users found."); ?></b>
		<?php endif; ?>
	</div>
</div>
<script type="text/javascript">
	var Microsite = function() {
		function open(url) {
			var identity = 'dialog-microsite';

			$("#"+ identity).remove();
			$('<div id="'+ identity +'" title="<?php echo $this->translate->_("View Microsite"); ?>" class="ui-state-highlight">'+
				'<div style="position: relative; margin: 8px 0px 2px 0px;">'+
					'<div id="frame_overlay" style="opacity: 0.9; background: white url(/images/ajax-loader.gif) center center no-repeat; position: absolute; top: 1px; left: 1px; width: 837px; height: 500px;"></div>'+
					'<iframe id="frame" name="microsite" src="'+ SITE_URL + url +'/index/iframe/true" width="837" height="500" scrolling="no" style="display: block; border: 1px solid #ddd;"></iframe>'+
				'</div>'+
			'</div>').dialog({
				resizable: false,
				modal: true,
				width: 862,
				minHeight: 50,
				buttons: [{
					text: '<?php echo $this->translate->_("Close"); ?>',
					click: function() {
						$(this).dialog("close");
					}
				}],
				close: function() {
					$("#"+ identity).remove();
				},
				open: function() {
					$('#frame').load(function() {
						$('#frame_overlay').fadeOut('fast');
						$("#frame").contents().find('a').click(function() {
							if( !$(this).hasClass('showloading') )
								return true;

							$('#frame_overlay').fadeIn('fast');
						});
					});
				}
			});
		};

		function __construct() {
			$('a.microsite').click(function() {
				open($(this).attr('rel'));
			});
		};

		return {
			init: __construct
		}
	}();

	var Privacy = function() {
		function hideFields() {
			$('[class*="private"], [class*="empty"]').each(function(s, i){
				var td = $(i).parent().parent();
				$(i).parent().remove();

				if(!td.has('span').length > 0)
					td.find('div').remove();
			});
		};

		function __construct() {
			hideFields();
		};

		return {
			init: __construct
		}
	}();

	READY(Microsite.init);
	READY(Privacy.init);
</script>